package com.vf.admin.client.dao;

import cn.hutool.core.util.ObjectUtil;
import com.vf.admin.client.dto.RoomMemberDto;
import com.vf.admin.common.db.BaseDao;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppUnReadUser;
import com.vf.admin.miaodong.entity.AppUser;
import com.vf.admin.utils.StringEx;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.*;

/**
 * 用户
 */
@Repository
public class AppUserDao extends BaseDao<AppUser> {

    /**
     * 查询列表
     */
    public List<AppUser> list(Map<String, Object> paraMap, SplitPageBean splitPage) {
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select a.* from app_user a where 1=1");


        if (paraMap.containsKey("pic") && StringEx.isNotNull(paraMap.get("pic"))){

            sbStr.append(" and a.pic not in ( ? )");
            paramList.add(paraMap.get("pic"));
        }

        if (paraMap.containsKey("onlinestatus") && StringEx.isNotNull(paraMap.get("onlinestatus"))) {
            sbStr.append(" and a.onlinestatus = ? ");
            paramList.add(paraMap.get("onlinestatus"));
        }

        if (paraMap.containsKey("sex") && StringEx.isNotNull(paraMap.get("sex"))) {
            sbStr.append(" and a.sex = ? ");
            paramList.add(paraMap.get("sex"));
        }
        if (paraMap.containsKey("gender") && StringEx.isNotNull(paraMap.get("gender"))) {
            sbStr.append(" and a.gender = ? ");
            paramList.add(paraMap.get("gender"));
        }
        if (paraMap.containsKey("realAuthStatus") && StringEx.isNotNull(paraMap.get("realAuthStatus"))) {
            sbStr.append(" and id in (select userId from app_auth_user where authNameEn='REAL_AUTH' and status=2) ");
        }
        if (paraMap.containsKey("cityCode") && StringEx.isNotNull(paraMap.get("cityCode"))) {
            sbStr.append(" and a.shengid=? ");
            paramList.add(paraMap.get("cityCode"));
        }
        if (paraMap.containsKey("eduStatus") && StringEx.isNotNull(paraMap.get("eduStatus"))) {
            sbStr.append(" and a.eduStatus >= ?");
            paramList.add(paraMap.get("eduStatus"));
        }
        if (paraMap.containsKey("start") && StringEx.isNotNull(paraMap.get("start")) &&
                paraMap.containsKey("end") && StringEx.isNotNull(paraMap.get("end"))) {
            sbStr.append(" and DATE_FORMAT(a.birthday, '%Y-%m-%d')  >=  ? ");
            paramList.add(paraMap.get("start"));

            sbStr.append(" and DATE_FORMAT(a.birthday, '%Y-%m-%d')  <=  ? ");
            paramList.add(paraMap.get("end"));
        }
        if (paraMap.containsKey("states") && StringEx.isNotNull(paraMap.get("states"))) {
            sbStr.append(" and a.states = ? ");
            paramList.add(paraMap.get("states"));
        }
        //是否真实用户is_real
        if (paraMap.containsKey("isReal") && StringEx.isNotNull(paraMap.get("isReal"))) {
            sbStr.append(" and a.isReal = ? ");
            paramList.add(paraMap.get("isReal"));
        }
        //是否附近-会员：isNearVip----数据号0+真实号
        if(paraMap.containsKey("isNearVip") && StringEx.isNotNull(paraMap.get("isNearVip"))){
            sbStr.append(" and a.isReal in (0, 1)");
        }
        if (paraMap.containsKey("ids") && StringEx.isNotNull(paraMap.get("ids"))) {
            sbStr.append(" and a.id in (  ");
            sbStr.append(paraMap.get("ids"));
            sbStr.append(" ) ");
        }
        //popose
        if (paraMap.containsKey("packageName") && StringEx.isNotNull(paraMap.get("packageName"))) {
            sbStr.append(" and a.packageName = ? ");
            paramList.add(paraMap.get("packageName"));
        }
        sbStr.append(" order by a.createtime desc");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, splitPage);
    }

    /**
     * 查询列表
     */
    public List<AppUser> zaixianList() {
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where onlinestatus!=2  ");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, null);
    }

    /**
     * 查询列表
     */
    public List<AppUser> huiyuanList() {
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where isguizu=1  ");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, null);
    }

    public List<AppUser> vipExpired() {
        ArrayList<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("SELECT * FROM `app_user` where vipEndDate < now()");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class);
    }

    public void updateVipExpire(String userIds) {
        ArrayList<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("update app_user set vipEndDate=null where id in (" + userIds + ")");
        String sql = sbStr.toString();
        this.update(sql, paramList);
    }

    /**
     * 查询列表
     */
    public List<AppUser> getSearch(String sousuo, SplitPageBean page) {
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where 1=1  ");
        sbStr.append(" and ( usercode like ? or nick like ? or goodusercode like ?) ");
        paramList.add("%" + sousuo + "%");
        paramList.add("%" + sousuo + "%");
        paramList.add("%" + sousuo + "%");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, page);
    }


    /**
     * 详情
     */
    public AppUser get(Integer id) {
        if (StringEx.isNullOrLing(id)) {
            return null;
        }
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where 1=1");
        sbStr.append(" and id = ?");
        paramList.add(id);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    public AppUser getByTxCode(Integer txCode) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where tengxuncode=?");
        paramList.add(txCode);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }


    /**
     * 配合事务实现锁的功能
     */
    public AppUser lockGet(Integer id) {
        if (StringEx.isNullOrLing(id)) {
            return null;
        }
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where id = ? FOR UPDATE");
        paramList.add(id);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    /**
     * 获取1V1主播的用户列表
     */
    public List<AppUser> oneUsers(Integer userId, Integer id, SplitPageBean splitPageBean) {
        if (StringEx.isNullOrLing(id)) {
            return null;
        }
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where 1=1");
        sbStr.append(" and shiid = ? ");
        paramList.add(id);
        sbStr.append(" and id <> ? ");
        paramList.add(userId);
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, splitPageBean);
    }


    /**
     * 详情
     */
    public AppUser getTcOrId(Integer id) {
        if (StringEx.isNullOrLing(id)) {
            return null;
        }
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where 1=1");
        sbStr.append(" and (id = ? or tengxuncode =? ) ");
        paramList.add(id);
        paramList.add(id);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    /**
     * 添加/修改
     */
    public void save(AppUser haoYou) {
        if (haoYou.getId() != null && haoYou.getId() > 0) {
            this.update(haoYou);
        } else {
            haoYou.setId(this.add(haoYou));
        }
    }


    /**
     * 后台管理获取所有用户
     *
     * @param map
     * @param bean
     * @return
     */
    public List<AppUser> findList(Map<String, Object> map, SplitPageBean bean) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append(" SELECT a.* FROM app_user a where 1=1 ");
        if (StringEx.isNotNull(map.get("loginname"))) {
            sbStr.append(" and a.loginname like ? ");
            paramList.add("%" + map.get("loginname") + "%");
        }
        if (StringEx.isNotNull(map.get("code"))) {
            sbStr.append(" and a.code = ? ");
            paramList.add(map.get("code"));
        }
        if (StringEx.isNotNull(map.get("states"))) {
            sbStr.append(" and a.states = ? ");
            paramList.add(map.get("states"));
        }
        if (StringEx.isNotNull(map.get("status"))) {
            sbStr.append(" and a.status = ? ");
            paramList.add(map.get("status"));
        }
        if (StringEx.isNotNull(map.get("nick"))) {
            sbStr.append(" and a.nick like  ? ");
            paramList.add("%" + map.get("nick") + "%");
        }
        if (StringEx.isNotNull(map.get("startDate"))) {
            sbStr.append(" and DATE_FORMAT(a.createtime, '%Y-%m-%d')  >=  ? ");
            paramList.add(map.get("startDate"));
        }
        if (StringEx.isNotNull(map.get("endDate"))) {
            sbStr.append(" and DATE_FORMAT(a.createtime, '%Y-%m-%d')  <=  ? ");
            paramList.add(map.get("endDate"));
        }
        if (map.containsKey("isGuildAccount") && StringEx.isNotNull(map.get("isGuildAccount"))) {
            sbStr.append(" and isGuildAccount = ? ");
            paramList.add(map.get("isGuildAccount"));
        }
        if (map.containsKey("isGuildAccount") && StringEx.isNotNull(map.get("isGuildAccount"))) {
            sbStr.append(" and isGuildAccount = ? ");
            paramList.add(map.get("isGuildAccount"));
        }
        if (StringEx.isNotNull(map.get("sex"))) {
            sbStr.append(" and a.sex = ? ");
            paramList.add(map.get("sex"));
        }
        if (StringEx.isNotNull(map.get("isReal"))) {
            sbStr.append(" and a.isReal = ? ");
            paramList.add(map.get("isReal"));
        }
        String sql = sbStr.toString();
        sbStr.append(" order by a.createtime desc ");
        return this.queryList(sql, paramList, AppUser.class, bean);
    }

    public List<AppUnReadUser> findUnReadList(Map<String, Object> map, SplitPageBean bean) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append(" SELECT a.* FROM app_user a where 1=1 ");
        if (StringEx.isNotNull(map.get("sex"))) {
            sbStr.append(" and a.sex = ? ");
            paramList.add(map.get("sex"));
        }
        if (StringEx.isNotNull(map.get("isReal"))) {
            sbStr.append(" and a.isReal = ? ");
            paramList.add(map.get("isReal"));
        }
        String sql = sbStr.toString();
        sbStr.append(" order by a.createtime desc ");
        return this.queryList(sql, paramList, AppUnReadUser.class, bean);
    }

    public List<AppUser> userCount(Map<String, Object> map) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append(" SELECT * FROM app_user where 1=1 ");

//        if (map.containsKey("today") && StringEx.isNotNull(map.get("today"))) {
//            sbStr.append(" and to_days(createtime) = to_days(now())");
//        }
        if (map.containsKey("today") && StringEx.isNotNull(map.get("today"))) {
            sbStr.append(" and createtime like ? ");
            paramList.add("%" + map.get("today") + "%");
        }
        //本月
        if (map.containsKey("month") && StringEx.isNotNull(map.get("month"))) {
            sbStr.append(" and createtime like ? ");
            paramList.add("%" + map.get("month") + "%");
        }
        if (map.containsKey("states") && StringEx.isNotNull(map.get("states"))) {
            sbStr.append(" and states = ? ");
            paramList.add(map.get("states"));
        }

        if (map.containsKey("isReal") && StringEx.isNotNull(map.get("isReal"))) {
            sbStr.append(" and isReal = ? ");
            paramList.add(map.get("isReal"));
        }

        if (map.containsKey("sex") && StringEx.isNotNull(map.get("sex"))) {
            sbStr.append(" and sex = ? ");
            paramList.add(map.get("sex"));
        }


        //客服 时间区间查询
        if (StringEx.isNotNull(map.get("todayStartTime")) && StringEx.isNotNull(map.get("todayEndTime")) && map.size()==2) {
            sbStr.append(" and createtime >= ? ");
            paramList.add(map.get("todayStartTime"));

            sbStr.append(" and createtime <= ? ");
            paramList.add(map.get("todayEndTime"));

        }


        //客服 时间区间查询
        if (StringEx.isNotNull(map.get("todayStartTime1")) && StringEx.isNotNull(map.get("todayEndTime1")) && map.size()==4) {
            sbStr.append("and ( createtime >= ? ");
            paramList.add(map.get("todayStartTime"));

            sbStr.append(" and createtime <= ? ");
            paramList.add(map.get("todayEndTime"));


            sbStr.append(" or createtime >= ? ");
            paramList.add(map.get("todayStartTime1"));

            sbStr.append(" and createtime <= ? )");
            paramList.add(map.get("todayEndTime1"));


        }

        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class);
    }


    public int getCount(Map<String, Object> map){
        List<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append(" SELECT count(id) FROM app_user where 1=1 ");
        if (map.containsKey("today") && StringEx.isNotNull(map.get("today"))) {
            sbStr.append(" and createtime like ? ");
            paramList.add("%" + map.get("today") + "%");
        }
        //本月
        if (map.containsKey("month") && StringEx.isNotNull(map.get("month"))) {
            sbStr.append(" and createtime like ? ");
            paramList.add("%" + map.get("month") + "%");
        }
        if (map.containsKey("states") && StringEx.isNotNull(map.get("states"))) {
            sbStr.append(" and states = ? ");
            paramList.add(map.get("states"));
        }

        if (map.containsKey("isReal") && StringEx.isNotNull(map.get("isReal"))) {
            sbStr.append(" and isReal = ? ");
            paramList.add(map.get("isReal"));
        }

        if (map.containsKey("sex") && StringEx.isNotNull(map.get("sex"))) {
            sbStr.append(" and sex = ? ");
            paramList.add(map.get("sex"));
        }

        //客服 时间区间查询
        if (StringEx.isNotNull(map.get("todayStartTime")) && StringEx.isNotNull(map.get("todayEndTime")) && map.size()==2) {
            sbStr.append(" and createtime >= ? ");
            paramList.add(map.get("todayStartTime"));
            sbStr.append(" and createtime <= ? ");
            paramList.add(map.get("todayEndTime"));
        }

        //客服 时间区间查询
        if (StringEx.isNotNull(map.get("todayStartTime1")) && StringEx.isNotNull(map.get("todayEndTime1")) && map.size()==4) {
            sbStr.append("and ( createtime >= ? ");
            paramList.add(map.get("todayStartTime"));
            sbStr.append(" and createtime <= ? ");
            paramList.add(map.get("todayEndTime"));
            sbStr.append(" or createtime >= ? ");
            paramList.add(map.get("todayStartTime1"));
            sbStr.append(" and createtime <= ? )");
            paramList.add(map.get("todayEndTime1"));
        }
        String sql = sbStr.toString();
        return this.queryListCount(sql, paramList);
    }

    /**
     * 根据邀请码查询用户
     *
     * @param code
     * @return
     */
    public AppUser getUserByCode(String code) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append(" select * from app_user  where code = ?");
        paramList.add(code);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    public List<AppUser> getSonUser(String parentCode) {
        List<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append(" select * from app_user where invitationcode = ?");
        paramList.add(parentCode);
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class);
    }

    /**
     * 根据usercode查询用户
     *
     * @param usercode
     * @return
     */
    public AppUser getUserCode(String usercode) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append(" select * from app_user  where usercode = ?");
        paramList.add(usercode);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    public List<AppUser> getInvitationCode(String getInvitationCode) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append(" select * from app_user  where invitationcode = ?");
        paramList.add(getInvitationCode);
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class);
    }


    /**
     * 账号状态修改
     *
     * @param id
     * @param state
     */
    public void upstate(Integer id, Integer state) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(state)) {
            return;
        }
        String sql = " UPDATE app_user SET states = ?  WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(state);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 变更在线状态   0直播中   1在线   2离线
     *
     * @param id
     * @param state
     */
    public void onlineUpstate(Integer id, Integer state) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(state)) {
            return;
        }
        String sql = " UPDATE app_user SET onlinestatus = ? ,endonlinetime=?  WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(state);
        paramList.add(new Date());
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 变更用户发送文字消息数量
     *
     * @param id
     * @param state
     */
    public void addMessage(Integer id, Integer state) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(state)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();

        StringBuffer sql = new StringBuffer(" UPDATE app_user ");
        if (state == 1) {
            sql.append(" SET messagenum = 1 ");
        } else {
            sql.append(" SET messagenum = messagenum+1 ");
        }
        sql.append(" , messagetime = ? ");
        paramList.add(new Date());
        sql.append(" WHERE id = ?  ");
        paramList.add(id);
        this.update(sql.toString(), paramList);
    }

    /**
     * 变更用户上一次所在的房间腾讯code
     *
     * @param id
     * @param lastroomtxcode
     */
    public void lastroomtxcode(Integer id, Integer lastroomtxcode) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(lastroomtxcode)) {
            return;
        }
        String sql = " UPDATE app_user SET lastroomtxcode = ?  WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(lastroomtxcode);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 根据账号，密码查询用户信息
     *
     * @Param: [map]
     * @return: com.vf.admin.miaodong.entity.AppUser
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public AppUser findByUser(String loginname, String password) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" select * from app_user where 1=1 ");
        if (StringEx.isNotNull(loginname)) {
            sbstr.append(" and loginname = ? ");
            paramList.add(loginname);
        }
        if (StringEx.isNotNull(password)) {
            sbstr.append(" and password = ? ");
            paramList.add(password);
        }
        String sql = sbstr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    /**
     * 根据用户名获取用户信息
     */
    public AppUser findByLoginname(String loginname) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" select * from app_user where 1=1 ");
        if (StringEx.isNotNull(loginname)) {
            sbstr.append(" and loginname = ? ");
            paramList.add(loginname);
        }
        String sql = sbstr.toString();
        List<AppUser> appUser = this.queryList(sql, paramList, AppUser.class);
        if (ObjectUtil.isNotEmpty(appUser)){
            return appUser.get(0);
        }
        return null;
    }

    /**
     * 谷歌ID查询用户信息
     */
    public AppUser findByGooleId(String id) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" select * from app_user where 1=1 ");
        if (StringEx.isNotNull(id)) {
            sbstr.append(" and qqopenid = ? ");
            paramList.add(id);
        }
        String sql = sbstr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    /**
     * faccbackID查询用户信息
     */
    public AppUser findByFaccBackId(String id) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" select * from app_user where 1=1 ");
        if (StringEx.isNotNull(id)) {
            sbstr.append(" and faccebookid = ? ");
            paramList.add(id);
        }
        String sql = sbstr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }


    /**
     * 苹果ID查询用户信息
     */
    public AppUser findByAppleBackId(String id) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" select * from app_user where 1=1 ");
        if (StringEx.isNotNull(id)) {
            sbstr.append(" and address = ? ");
            paramList.add(id);
        }
        String sql = sbstr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    /**
     * 找回密码，修改密码
     *
     * @Param: [id 用户id, password 密码]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public void upPassword(Integer id, String password) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(password)) {
            return;
        }
        String sql = " update app_user set password = ?  where id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(password);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 修改，保存身高
     *
     * @Param: [id 用户id, shengao 身高]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public void upshengao(Integer id, String shengao, Integer shengaoid) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(shengao)) {
            return;
        }
        String sql = " update app_user set shengao = ?, shengaoid=?  where id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(shengao);
        paramList.add(shengaoid);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 修改，保存体重
     *
     * @Param: [id 用户id, tizhong 体重]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public void uptizhong(Integer id, String tizhong, Integer tizhongid) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(tizhong)) {
            return;
        }
        String sql = " update app_user set tizhong = ?,tizhongid=?  where id = ? ";

        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(tizhong);
        paramList.add(tizhongid);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 修改，保存年收入
     *
     * @Param: [id 用户id, nian 年收入]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public void upnianshouru(Integer id, String nian, Integer nianid) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(nian)) {
            return;
        }
        String sql = " update app_user set nianshouru = ?,nianshouruid=?  where id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(nian);
        paramList.add(nianid);
        paramList.add(id);
        this.update(sql, paramList);
    }

    public void upxueli(Integer id, String xueli, Integer xueliId) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(xueli)) {
            return;
        }
        String sql = " update app_user set eduStatusRu = ?,eduStatus = ?  where id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(xueli);
        paramList.add(xueliId);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 修改，保存职业
     *
     * @Param: [id 用户id, zhiyecode 职业编号， zhiyename 职业名]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public void upzhiye(Integer id, Integer zhiyecode, String zhiyename) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(zhiyecode)) {
            return;
        }
        if (StringEx.isNull(zhiyename)) {
            return;
        }
        String sql = " update app_user set zhiyecode = ?,zhiyename = ?  where id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(zhiyecode);
        paramList.add(zhiyename);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 修改，保存标签
     *
     * @Param: [id 用户id, biaoqianid 标签id， biaoqianname 标签名]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public void upbiaoqian(Integer id, String biaoqianid, String biaoqianname) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(biaoqianid)) {
            return;
        }
        if (StringEx.isNull(biaoqianname)) {
            return;
        }
        String sql = " update app_user set biaoqianid = ?,biaoqianname = ?  where id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(biaoqianid);
        paramList.add(biaoqianname);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 修改，保存昵称
     *
     * @Param: [id 用户id, nick 昵称]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public void upnick(Integer id, String nick) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(nick)) {
            return;
        }
        String sql = " UPDATE app_user SET nick = ?   WHERE id = ?  ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(nick);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 修改，保存个性签名
     *
     * @Param: [id 用户id, mysign 个性签名]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public void upMysign(Integer id, String mysign) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(mysign)) {
            return;
        }
        String sql = " UPDATE app_user SET mysign = ?   WHERE id = ?  ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(mysign);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 编辑支付宝信息
     *
     * @Param: [id 用户id, name 收款人（支付宝绑定的人）, alipay 支付宝号]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     * @Time: 17:44
     */
    public void upAlipay(Integer id, String name, String alipay) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(name) || StringEx.isNull(alipay)) {
            return;
        }
        String sql = " UPDATE app_user SET shoukuanren = ? ,alipay = ?  WHERE id = ?  ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(name);
        paramList.add(alipay);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 编辑地址信息
     *
     * @Param: [id 用户id, address 地址]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     * @Time: 18:52
     */
    public void upAddress(Integer id, String address, Integer shengid, Integer shiid, Integer areaId) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(address)) {
            return;
        }
        String sql = " UPDATE app_user SET address = ?,shengid=?,shiid=?,areaId=?  WHERE id = ?  ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(address);
        paramList.add(shengid);
        paramList.add(shiid);
        paramList.add(areaId);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 编辑生日信息
     *
     * @Param: [id 用户id, birthday 生日]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     * @Time: 19:21
     */
    public void upbirthday(Integer id, Date birthday) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(birthday)) {
            return;
        }
        String sql = " UPDATE app_user SET birthday = ?  WHERE id = ?  ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(birthday);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 完善基础信息
     *
     * @Param: [id 用户id, shengri 生日，]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     * @Time: 19:21
     */
    public void completeMaterial(Integer id, String pic, String nicheng, Integer sex, Date shengri, String password,String packageName) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(pic)) {
            return;
        }
        if (StringEx.isNull(nicheng)) {
            return;
        }
        if (StringEx.isNull(sex)) {
            return;
        }
        if (StringEx.isNull(shengri)) {
            return;
        }
        String sql = " UPDATE app_user SET birthday = ? , `nick` = ? ,`pic` = ? , `sex` = ? , `iswanshan` = 1 ";
        if (StringEx.isNotNull(password)) {
            sql += ", password = '" + password + "'";
        }
        if (StringEx.isNotNull(packageName)) {
            sql += ", packageName = '" + packageName + "'";
        }
        sql += " WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(shengri);
        paramList.add(nicheng);
        paramList.add(pic);
        paramList.add(sex);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 编辑头像
     *
     * @Param: [id 用户id, pic 头像]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/22
     * @Time: 9:24
     */
    public void uppic(Integer id, String pic) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(pic)) {
            return;
        }
        String sql = " UPDATE app_user SET pic = ?  WHERE id = ?  ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(pic);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 绑定上级
     *
     * @Param: [id 用户id, yaoqingma 邀请码]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/22
     * @Time: 9:24
     */
    public void bindSuperior(Integer id, String yaoqingma) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(yaoqingma)) {
            return;
        }
        String sql = " UPDATE app_user SET invitationcode = ?  WHERE id = ?  ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(yaoqingma);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 编辑形象照片信息
     *
     * @Param: [id 用户id, xxpic 照片]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/22
     * @Time: 9:47
     */
    public void upxingxiang(Integer id, String xxpic) {
        if (StringEx.isNull(id)) {
            return;
        }
        String sql = " UPDATE app_user SET xingxiang = ?  WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(xxpic);
        paramList.add(id);
        this.update(sql, paramList);
    }

    public AppUser existsNameAndIdNum(String realName, String idNum) {
        List<Object> params = new ArrayList<>();
        String sql = " select * from app_user where realname=? and idnum=? limit 1";
        params.add(realName);
        params.add(idNum);
        return this.queryObj(sql, params, AppUser.class);
    }

    public void updateRealName(Integer userId, String realName, String idNum) {
        if (StringEx.isNull(realName) || StringEx.isNull(idNum)) {
            return;
        }
        String sql = " UPDATE app_user SET xingming = ?, realname = ?, idnum = ?, status = 1 WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(realName);
        paramList.add(realName);
        paramList.add(idNum);
        paramList.add(userId);
        this.update(sql, paramList);
    }

    public void updateEdu(Integer userId, Integer eduStatus) {

        String sql = " UPDATE app_user SET eduStatus = ? id = ? ";
        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(eduStatus);
        paramList.add(userId);
        this.update(sql, paramList);
    }



    /**
     * 根据用户code查询用户信息
     *
     * @Param: [usercode 用户账号]
     * @return: com.vf.admin.miaodong.entity.AppUser
     * @Author: zhouyunyi
     * @Date: 2021/07/21
     */
    public AppUser getUsercodeByUser(String usercode) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append("select * from app_user where usercode = ? ");
        paramList.add(usercode);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    /**
     * 根据腾讯code查询用户
     *
     * @Param: [tengxuncode]
     * @return: com.vf.admin.miaodong.entity.AppUser
     * @Author: zhouyunyi
     * @Date: 2021/07/28
     * @Time: 12:43
     */
    public AppUser getTengxuncodeByUser(Integer tengxuncode) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append("select * from app_user where tengxuncode = ? ");
        paramList.add(tengxuncode);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    /**
     * 根据腾讯code批量查询用户
     *
     * @Param: [tengxuncode]
     * @return: com.vf.admin.miaodong.entity.AppUser
     * @Author: zhouyunyi
     * @Date: 2021/07/28
     * @Time: 12:43
     */
    public List<RoomMemberDto> getBatchTengxuncodeByUser(String tengxuncode, String likecha, SplitPageBean splitPage) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append("select * from app_user where tengxuncode IN ( ");
        sbStr.append(tengxuncode);
        sbStr.append(" ) ");
        sbStr.append(" and (nick like ? or usercode like ? ) ");
        paramList.add("%" + likecha + "%");
        paramList.add("%" + likecha + "%");

        String sql = sbStr.toString();
        return this.queryList(sql, paramList, RoomMemberDto.class, splitPage);
    }

    /**
     * 根据腾讯code批量查询用户
     *
     * @Param: [tengxuncode]
     * @return: com.vf.admin.miaodong.entity.AppUser
     * @Author: zhouyunyi
     * @Date: 2021/07/28
     * @Time: 12:43
     */
    public List<AppUser> getPiliangTengxuncodeByUser(String tengxuncode) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append("select * from app_user where tengxuncode IN ( ");
        sbStr.append(tengxuncode);
        sbStr.append(" ) ");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, null);
    }


    /**
     * 根据用户IDS批量查询用户
     *
     * @Param: [tengxuncode]
     * @return: com.vf.admin.miaodong.entity.AppUser
     * @Author: zhouyunyi
     * @Date: 2021/07/28
     * @Time: 12:43
     */
    public List<AppUser> selectIdsByUser(String ids) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append("select * from app_user where id IN ( ");
        sbStr.append(ids);
        sbStr.append(" ) ");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, null);
    }


    /**
     * 根据邀请码批量查询用户
     *
     * @Param: [tengxuncode]
     * @return: com.vf.admin.miaodong.entity.AppUser
     * @Author: zhouyunyi
     * @Date: 2021/07/28
     * @Time: 12:43
     */
    public List<AppUser> getPiliangYaoqingma(String yaoqingma) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append("select * from app_user where code IN ( ");
        sbStr.append(yaoqingma);
        sbStr.append(" ) ");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, null);
    }

    /**
     * 修改支付密码
     *
     * @Param: [paypassword 支付密码]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/28
     * @Time: 17:02
     */
    public void upzhifumima(Integer id, String paypassword) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(paypassword)) {
            return;
        }
        String sql = " UPDATE app_user SET paypassword = ?  WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(paypassword);
        paramList.add(id);
        this.update(sql, paramList);

    }

    /**
     * 绑定微信信息
     *
     * @Param: [id, openid]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/29
     * @Time: 11:26
     */
    public void bangdingweixin(Integer id, String openid) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(openid)) {
            return;
        }
        String sql = " UPDATE app_user SET weixinopenid = ? WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(openid);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /*
     * @Description 更新用户金币
     * @Param: [id, jinbi]
     * @return: void
     * @Author: ljx
     * @Date: 2020/10/22
     */
    public void updatejinbi(Integer id, BigDecimal jinbi) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(jinbi)) {
            return;
        }
        String sql = " UPDATE app_user SET jinbi = jinbi+ ?  WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(jinbi);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * @Description 获取用户附近人
     * @Param: [lon经度, lat维度, id]
     * @return: java.util.List<com.vf.admin.miaodong.entity.AppUser>
     * @Author: ljx
     * @Date: 2021/07/22
     */
    public List<AppUser> getFujinRenList(Map<String, Object> paraMap, SplitPageBean splitPageBean) {
        List<Object> paramList = new ArrayList<>();
//        StringBuilder sbStr = new StringBuilder("select *,acos(sin((?*3.1415)/180) * sin((lat*3.1415)/180) + cos((?*3.1415)/180) * cos((lat*3.1415)/180) * cos((?*3.1415)/180 - (lon*3.1415)/180))*6370.996 as distince from app_user where nearfunction = 1");
        StringBuilder sbStr = new StringBuilder("select * from app_user where 1 = 1");




//        sbStr.append("select *,acos(sin((?*3.1415)/180) * sin((lat*3.1415)/180) +" +
//                "             cos((?*3.1415)/180) * cos((lat*3.1415)/180) * cos((?*3.1415)/180 - (lon*3.1415)/180) " +
//                "             )*6370.996 as distince from app_user " +
//                " where nearfunction = 1  and isReal = " + paraMap.get("isReal") + " and sex = " + paraMap.get("sex") + " and id not in(" + paraMap.get("hiddenUserIds") + ")" +
//                " having distince <= 50 order by distince asc");
//        paramList.add(paraMap.get("lat"));
//        paramList.add(paraMap.get("lat"));
//        paramList.add(paraMap.get("lon"));

        if (paraMap.containsKey("isReal") && StringEx.isNotNull(paraMap.get("isReal"))) {
            sbStr.append(" and isReal = ? ");
            paramList.add(paraMap.get("isReal"));
        }
        if (paraMap.containsKey("sex") && StringEx.isNotNull(paraMap.get("sex"))) {
            sbStr.append(" and sex = ? ");
            paramList.add(paraMap.get("sex"));
        }

        if (paraMap.containsKey("hiddenUserIds") && StringEx.isNotNull(paraMap.get("hiddenUserIds"))) {
            sbStr.append(" and id not in (  ");
            sbStr.append(paraMap.get("hiddenUserIds"));
            sbStr.append(" ) ");
        }

        if (paraMap.containsKey("ids") && StringEx.isNotNull(paraMap.get("ids"))) {
            sbStr.append(" and id in (  ");
            sbStr.append(paraMap.get("ids"));
            sbStr.append(" ) ");
        }

        if (paraMap.containsKey("packageName") && StringEx.isNotNull(paraMap.get("packageName"))) {
            sbStr.append(" and packageName = ? ");
            paramList.add(paraMap.get("packageName"));
        }


//        sbStr.append("having distince <= 50 order by distince asc");
//        sbStr.append("order by distince asc");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, splitPageBean);
    }
//    public List<AppUser> getFujinRenList(Map<String, Object> paraMap, SplitPageBean splitPageBean) {
//        List<Object> paramList = new ArrayList<>();
//        StringBuilder sbStr = new StringBuilder("");
//
//        sbStr.append("select *,acos(sin((?*3.1415)/180) * sin((lat*3.1415)/180) +" +
//                "             cos((?*3.1415)/180) * cos((lat*3.1415)/180) * cos((?*3.1415)/180 - (lon*3.1415)/180) " +
//                "             )*6370.996 as distince from app_user " +
//                " where nearfunction = 1  and isReal = " + paraMap.get("isReal") + " and sex = " + paraMap.get("sex") + " and id not in(" + paraMap.get("hiddenUserIds") + ")" +
//                " having distince <= 50 order by distince asc");
//        paramList.add(paraMap.get("lat"));
//        paramList.add(paraMap.get("lat"));
//        paramList.add(paraMap.get("lon"));
//
//
//        String sql = sbStr.toString();
//        return this.queryList(sql, paramList, AppUser.class, splitPageBean);
//    }

    /**
     * @Description 获取在线的异性用户
     * @Param: [lon经度, lat维度, id]
     * @return: java.util.List<com.vf.admin.miaodong.entity.AppUser>
     * @Author: ljx
     * @Date: 2021/07/22
     */
    public List<AppUser> getZaixianYixingList(Integer id, Integer sex) {
        if (id == null) {
            return null;
        }

        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append("SELECT * FROM app_user WHERE 1=1 and id != ? and sex=? and onlinestatus != 2 ");
        paramList.add(id);
        paramList.add(sex);
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, null);
    }

    /**
     * @Description 获取全部用户
     * @Author: xzx
     * @Date: 2021/07/22
     */
    public List<AppUser> allList() {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append("SELECT * FROM app_user WHERE 1=1 ");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class, null);
    }


    /*
     * @Description 更新用户礼物特效操作
     * @Param: [id,用户ID  leixing 操作类型]
     * @return: void
     * @Author: ljx
     * @Date: 2021/07/22
     */
    public void updateLiWu(Integer id, Integer leixing) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(leixing)) {
            return;
        }
        String sql = " UPDATE app_user SET giftfunction = ?  WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(leixing);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /*
     * @Description 更新用户附近操作
     * @Param: [id, leixing]
     * @return: void
     * @Author: ljx
     * @Date: 2021/07/22
     */
    public void updateweizhi(Integer id, Integer leixing) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(leixing)) {
            return;
        }
        String sql = " UPDATE app_user SET nearfunction = ?  WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(leixing);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 减少用户金币
     *
     * @Param: [id, jinbi]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/28
     * @Time: 16:08
     */
    public void upJianjinbi(Integer id, BigDecimal jinbi) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(jinbi)) {
            return;
        }
        String sql = " UPDATE app_user SET jinbi = jinbi- ?  WHERE id = ? and jinbi >= ?";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(jinbi);
        paramList.add(id);
        paramList.add(jinbi);
        this.update(sql, paramList);
    }

    /*
     * @Description 更新钻石数量
     * @Param: [id, zuanshi]
     * @return: void
     * @Author: ljx
     * @Date: 2021/07/24
     */
    public void updateZuanShi(Integer id, BigDecimal zuanshi) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(zuanshi)) {
            return;
        }
        String sql = " UPDATE app_user SET diamonds = diamonds + ?  WHERE id = ?";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(zuanshi);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 减少钻石数量
     *
     * @Param: [id, zuanshi]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/28
     * @Time: 16:09
     */
    public void upJianZuanShi(Integer id, BigDecimal zuanshi) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(zuanshi)) {
            return;
        }
        String sql = " UPDATE app_user SET diamonds = diamonds - ?  WHERE id = ? and diamonds >= ?";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(zuanshi);
        paramList.add(id);
        paramList.add(zuanshi);
        this.update(sql, paramList);
    }

    /*
     * @Description 更新魅力值数量
     * @Param: [id, meili]
     * @return: void
     * @Author: ljx
     * @Date: 2021/07/24
     */
    public void updatemeili(Integer id, long meili) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(meili)) {
            return;
        }
        String sql = " UPDATE app_user SET charmvalue = charmvalue + ?  WHERE id = ?";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(meili);
        paramList.add(id);
        this.update(sql, paramList);
    }


    /**
     * 减少魅力值
     *
     * @Param: [id, meili]
     * @return: void
     * @Author: zhouyunyi
     * @Date: 2021/07/28
     * @Time: 16:09
     */
    public void upJianmeili(Integer id, Integer meili) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(meili)) {
            return;
        }
        String sql = " UPDATE app_user SET charmvalue = charmvalue - ?  WHERE id = ? ";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(meili);
        paramList.add(id);
        this.update(sql, paramList);
    }

    /**
     * 用户动态总数变更
     *
     * @param id      用户id
     * @param leixing 1增加  2减少
     */
    public void dongtaiallUpdate(Integer id, Integer leixing) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(leixing)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        if (leixing == 1) {
            sbstr.append(" dongtaiall = dongtaiall+1 ");
        } else if (leixing == 2) {
            sbstr.append(" dongtaiall = dongtaiall-1  ");
        }
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }


    /**
     * 用户动态总数变更
     *
     * @param id    用户id
     * @param money 充值得现金金额
     */
    public void updateLeijiChongzhi(Integer id, BigDecimal money) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(money)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        sbstr.append(" chongzhimoney = chongzhimoney+? ");
        paramList.add(money);
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);

        this.update(sbstr.toString(), paramList);
    }

    /**
     * 获取指定用户获取信息
     *
     * @param arr 动态id 拼接
     * @return
     */
    public List<AppUser> getPiliang(String arr) {
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where 1=1  ");
        sbStr.append(" and id in ( ");
        sbStr.append(arr);
        sbStr.append(" ) ");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class);
    }

    /**
     * 用户关注总量变更
     *
     * @param id      用户id
     * @param leixing 1增加  2减少
     */
    public void guanzhuUpdate(Integer id, Integer leixing) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(leixing)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        if (leixing == 1) {
            sbstr.append(" guanzhu = guanzhu + 1 ");
        } else if (leixing == 2) {
            sbstr.append(" guanzhu = guanzhu - 1 ");
        }
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }

    /**
     * 房间收藏量变更
     *
     * @param id      用户id
     * @param leixing 1增加  2减少
     */
    public void roomCollectUpdate(Integer id, Integer leixing) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(leixing)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        if (leixing == 1) {
            sbstr.append(" roomcollectnum = roomcollectnum + 1 ");
        } else if (leixing == 2) {
            sbstr.append(" roomcollectnum = roomcollectnum - 1 ");
        }
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }

    /**
     * 用户新增动态数增加
     *
     * @param id 用户id
     */
    public void dongtaiNewUpdate(Integer id) {
        if (StringEx.isNull(id)) {
            return;
        }

        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        sbstr.append(" dongtai = dongtai + 1 ");
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }

    /**
     * 用户新增动态数清空
     *
     * @param id 用户id
     */
    public void dongtaiNewClear(Integer id) {
        if (StringEx.isNull(id)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        sbstr.append(" dongtai = 0 ");
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }


    /**
     * 用户粉丝总量变更
     *
     * @param id      用户id
     * @param leixing 1增加  2减少
     */
    public void fansnumallUpdate(Integer id, Integer leixing) {
        if (StringEx.isNull(id)) {
            return;
        }
        if (StringEx.isNull(leixing)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        if (leixing == 1) {
            sbstr.append(" fansnumall = fansnumall + 1 ");
        } else if (leixing == 2) {
            sbstr.append(" fansnumall = fansnumall - 1 ");
        }
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }

    /**
     * 用户新增粉丝数增加
     *
     * @param id 用户id
     */
    public void fensiNewUpdate(Integer id) {
        if (StringEx.isNull(id)) {
            return;
        }

        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        sbstr.append(" fansnum = fansnum + 1 ");
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }

    /**
     * 用户新增粉丝数清空
     *
     * @param id 用户id
     */
    public void fensiNewClear(Integer id) {
        if (StringEx.isNull(id)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        sbstr.append(" fansnum = 0 ");
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }

    /**
     * @Description 更新用户经纬度
     * @Param:
     * @return:
     * @Author: ljx
     * @Date: 2021/07/29
     */
    public void updateLonAndLat(Integer id, String address, String addressdetail, String lon, String lat) {
        if (StringEx.isNull(id)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        sbstr.append(" lon = ? , lat = ? , address = ? , addressdetail = ? ");
        sbstr.append(" WHERE id = ? ");
        paramList.add(lon);
        paramList.add(lat);
        paramList.add(address);
        paramList.add(addressdetail);
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }


    /**
     * @Description 更新用户贵族状态
     * @Param:
     * @return:
     * @Author: ljx
     * @Date: 2021/07/29
     */
    public void updateGuizu(Integer id, Integer guizuid) {
        if (StringEx.isNull(id)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        sbstr.append(" isguizu = 1 , nobleid = ? ");
        paramList.add(guizuid);
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }

    /**
     * @param id       用户id
     * @param type     操作状态  1增加  2减少
     * @param freetime 操作的时长
     * @Description 修改用户免费时长
     * @Author: xzx
     * @Date: 2021/07/29
     */
    public void updateFreeTime(Integer id, Integer type, Integer freetime) {
        if (StringEx.isNull(id)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        if (type == 1) {
            sbstr.append(" freetime = freetime+?  ");
        } else {
            sbstr.append(" freetime = freetime-?  ");
        }
        paramList.add(freetime);
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }

    /**
     * @Description 撤销用户贵族状态
     * @Param:
     * @return:
     * @Author: ljx
     * @Date: 2021/07/29
     */
    public void RevokeGuizu(Integer id) {
        if (StringEx.isNull(id)) {
            return;
        }
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbstr = new StringBuilder(" UPDATE app_user SET ");
        sbstr.append(" isguizu = 2 , nobleid = 0 ");
        sbstr.append(" WHERE id = ? ");
        paramList.add(id);
        this.update(sbstr.toString(), paramList);
    }

    public AppUser findByPhone(String phone) {
        ArrayList<Object> list = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where 1=1  ");
        sbStr.append(" and loginname = ?");
        list.add(phone);
        String sql = sbStr.toString();
        return this.queryObj(sql, list, AppUser.class);
    }

    public List<AppUser> getUserIdList() {
        ArrayList<Object> list = new ArrayList<>();
        StringBuilder str = new StringBuilder("select * from app_user where ");
        str.append("yinpinzb = ?").append(" and shipinzb = ?").append(" and states = ? ");
        list.add(1);
        list.add(1);
        list.add(1);
        String sql = str.toString();
        return this.queryList(sql, list, AppUser.class);
    }

    public List<AppUser> findAllList() {
        ArrayList<Object> list = new ArrayList<>();
        StringBuilder str = new StringBuilder("select * from app_user where 1=1");
        str.append(" and states = ?");
        list.add(1);
        String sql = str.toString();
        return this.queryList(sql, list, AppUser.class);
    }

    /**
     * 修改用户的经验值
     *
     * @param userid
     * @param experience
     */
    public void updateExperience(Integer userid, BigDecimal experience) {
        ArrayList<Object> list = new ArrayList<>();
        StringBuilder str = new StringBuilder();
        str.append("update app_user set experience = experience + ? where id = ?");
        list.add(experience);
        list.add(userid);
        String sql = str.toString();
        this.update(sql, list);
    }

    public void updateqiandao(int i, Integer id) {
        ArrayList<Object> list = new ArrayList<>();
        StringBuilder str = new StringBuilder();
        str.append("update app_user set lianxuqiandao = ? where id = ?");
        list.add(i);
        list.add(id);
        String sql = str.toString();
        this.update(sql, list);
    }

    public void familyPunchIn(int i, Integer id) {
        ArrayList<Object> list = new ArrayList<>();
        StringBuilder str = new StringBuilder();
        str.append("update app_user set familyPunchIn = ? where id = ?");
        list.add(i);
        list.add(id);
        String sql = str.toString();
        this.update(sql, list);
    }

    /**
     * 减少用户的金豆
     *
     * @param userId
     * @param jindou
     */
    public void subJindou(Integer userId, BigDecimal jindou) {
        ArrayList<Object> params = new ArrayList<>();
        StringBuilder str = new StringBuilder();
        str.append("update app_user set jindou = jindou - ? where id = ? and jindou >= ?");
        params.add(jindou);
        params.add(userId);
        params.add(jindou);
        String sql = str.toString();
        this.update(sql, params);
    }

    /**
     * 增加用户的金豆
     *
     * @param userId
     * @param jindou
     */
    public void addJindou(Integer userId, BigDecimal jindou) {
        ArrayList<Object> params = new ArrayList<>();
        StringBuilder str = new StringBuilder();
        str.append("update app_user set jindou = jindou + ? where id = ?");
        params.add(jindou);
        params.add(userId);
        String sql = str.toString();
        this.update(sql, params);
    }

    public void savePassword(String payPassword, Integer userId) {
        ArrayList<Object> params = new ArrayList<>();
        StringBuilder str = new StringBuilder();
        str.append("UPDATE app_user set paypassword = ? where id = ?");
        params.add(payPassword);
        params.add(userId);
        String sql = str.toString();
        this.update(sql, params);
    }

    public void updateLevelAndExperience(Integer id, int level, BigDecimal experience) {
        StringBuilder str = new StringBuilder();
        List list = new ArrayList();
        str.append("update app_user set userlevel = ? and experience = ? where id = ?");
        list.add(level);
        list.add(experience);
        list.add(id);
        String sql = str.toString();
        this.update(sql, list);
    }

    public void saveMessagePrice(Integer userId, Integer type, String price) {
        String baseSql = " UPDATE app_user ";
        String sql = "";

        if (type == 1) {
            sql = " SET messagePrice = ?";
        } else if (type == 2) {
            sql = " SET voicePrice = ?";
        } else if (type == 3) {
            sql = " SET videoPrice = ?";
        }
        sql += " where id = ?";
        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(price);
        paramList.add(userId);
        this.update(baseSql + sql, paramList);
    }

    public void updateMessagePrice(Integer userId, String price, String price1, String price2) {
        String baseSql = " UPDATE app_user SET messagePrice = ?, voicePrice = ?, videoPrice = ? where id = ?";
        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(price);
        paramList.add(price1);
        paramList.add(price2);
        paramList.add(userId);
        this.update(baseSql, paramList);
    }

    public void openVoiceStatus(Integer userId) {
        String sql = " UPDATE app_user SET voiceStatus = 1 where id = ?";

        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(userId);
        this.update(sql, paramList);
    }

    public void closeVoiceStatus(Integer userId) {
        String sql = " UPDATE app_user SET voiceStatus = 0 where id = ?";

        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(userId);
        this.update(sql, paramList);
    }

    public void openVideoStatus(Integer userId) {
        String sql = " UPDATE app_user SET videoStatus = 1 where id = ?";

        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(userId);
        this.update(sql, paramList);
    }

    public void closeVideoStatus(Integer userId) {
        String sql = " UPDATE app_user SET videoStatus = 0 where id = ?";

        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(userId);
        this.update(sql, paramList);
    }


    public AppUser randomGetUser(Integer sex) {
        String sql = "select * from app_user where sex=?";
        ArrayList<Object> list = new ArrayList<>();
        list.add(sex);
        Random random = new Random();
        List<AppUser> appUsers = this.queryList(sql, list, AppUser.class);
        if (appUsers != null && appUsers.size() > 0) {
            AppUser appUser = appUsers.get(random.nextInt(appUsers.size()));
            return appUser;
        } else {
            return null;
        }
    }


    public AppUser randomMatchUserByBiaoqian(Integer sex, String biaoqianid) {
        String sql = "select * from app_user where sex=? and onlinestatus=1 and biaoqianid like '%" + biaoqianid + "%'";
        ArrayList<Object> list = new ArrayList<>();
        list.add(sex);
        Random random = new Random();
        List<AppUser> appUsers = this.queryList(sql, list, AppUser.class);
        if (appUsers != null && appUsers.size() > 0) {
            AppUser appUser = appUsers.get(random.nextInt(appUsers.size()));
            return appUser;
        } else {
            return null;
        }
    }


    public AppUser randomMatchUserBylonAndLat(String lon, String lat, Integer sex) {
        String sql = "SELECT *,(st_distance (POINT (lon,lat),POINT( ? , ? ) ) * 111195  ) AS mi FROM app_user WHERE 1=1";
        sql += " and lon IS NOT NULL and sex=? and nearfunction = 1 and onlinestatus=1";
        ArrayList<Object> list = new ArrayList<>();
        list.add(lon);
        list.add(lat);
        list.add(sex);
        List<AppUser> appUsers = this.queryList(sql, list, AppUser.class);
        Random random = new Random();
        if (appUsers != null && appUsers.size() > 0) {
            AppUser appUser = appUsers.get(random.nextInt(appUsers.size()));
            return appUser;
        } else {
            return null;
        }
    }


    public List<AppUser> sameCityMatch(Integer sex, Integer shiid, Integer matchNum) {
        String sql = "select * from app_user where sex=? and shiid=?";
        ArrayList<Object> list = new ArrayList<>();
        list.add(sex);
        list.add(shiid);
        List<AppUser> appUsers = this.queryList(sql, list, AppUser.class);
        Random random = new Random();
        List<AppUser> appUsers1 = new ArrayList<>();
        if (appUsers != null && appUsers.size() > 0) {
            for (int i = 0; i < matchNum; i++) {
                int nint = random.nextInt(appUsers.size());
                AppUser appUser = appUsers.get(nint);
                appUsers1.add(appUser);
                appUsers.remove(nint);
                if (appUsers.size() <= 0) {
                    break;
                }
            }
            return appUsers1;
        } else {
            return null;
        }
    }


    public List<AppUser> sameCityRandomMatch(Integer sex, Integer matchNum) {
        String sql = "select * from app_user where sex=?";
        ArrayList<Object> list = new ArrayList<>();
        list.add(sex);
        List<AppUser> appUsers = this.queryList(sql, list, AppUser.class);
        Random random = new Random();
        List<AppUser> appUsers1 = new ArrayList<>();
        if (appUsers != null && appUsers.size() > 0) {
            for (int i = 0; i < matchNum; i++) {
                int nint = random.nextInt(appUsers.size());
                AppUser appUser = appUsers.get(nint);
                appUsers1.add(appUser);
                appUsers.remove(nint);
                if (appUsers.size() <= 0) {
                    break;
                }
            }
            return appUsers1;
        } else {
            return null;
        }
    }

    public void closeYoung(Integer userId) {
        String sql = " UPDATE app_user SET youngMode = 0, youngModePass = null where id = ?";

        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(userId);
        this.update(sql, paramList);
    }

    public AppUser findUserByThirdToken(String type, String token) {
        StringBuilder stringBuilder = new StringBuilder();
        ArrayList<Object> list = new ArrayList<>();
        stringBuilder.append("select * from app_user where");
        switch (type) {
            case "qq":
                stringBuilder.append(" qqopenid=?");
                break;
            case "weixin":
                stringBuilder.append(" weixinopenid=?");
                break;
            case "apple":
                stringBuilder.append(" appleId=?");
                break;
        }
        String sql = stringBuilder.toString();
        list.add(token);
        return this.queryObj(sql, list, AppUser.class);
    }

    public void updateUserThirdToken(Integer userId, String type, String token) {
        StringBuilder stringBuilder = new StringBuilder();
        ArrayList<Object> list = new ArrayList<>();
        stringBuilder.append("update app_user set");
        switch (type) {
            case "qq":
                stringBuilder.append(" qqopenid=?");
                break;
            case "weixin":
                stringBuilder.append(" weixinopenid=?");
                break;
            case "apple":
                stringBuilder.append(" appleId=?");
                break;
        }
        stringBuilder.append(" where id=?");
        String sql = stringBuilder.toString();
        list.add(token);
        list.add(userId);
        this.update(sql, list);
    }

    public List<AppUser> findUserListBySex(Integer sex) {
        String sql = "select * from app_user where sex=" + sex;
        return this.queryList(sql, new ArrayList<>(), AppUser.class);
    }

    public List<AppUser> findUserListByShuJuAndSex(Integer sex) {
        String sql = "select * from app_user where isReal = 0 and sex=" + sex;
        return this.queryList(sql, new ArrayList<>(), AppUser.class);
    }

    public void delUser(Integer userId) {
        String sql = "delete from app_user where id=" + userId;
        this.del(sql, null);
    }

    public List<AppUser> findOnlineUserListBySex(Integer sex, String ignoreUserIds, int limit) {
        StringBuilder sql = new StringBuilder("select * from app_user where iswanshan = 1 and states=1 and onlinestatus in (0,1)");
        sql.append(" and sex=" + sex);
        if (StringUtils.isNotBlank(ignoreUserIds)) {
            sql.append(" and id not in (" + ignoreUserIds + ")");
        }
        sql.append(" LIMIT " + limit);
        return this.queryList(sql.toString(), new ArrayList<>(), AppUser.class);
    }

    public AppUser getUserInfo(Integer id, String loginname, String tengxuncode) {

        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where 1=1");
        if (ObjectUtil.isNotEmpty(id)) {
            sbStr.append(" and id = ? ");
            paramList.add(id);
        }
        if (ObjectUtil.isNotEmpty(loginname)) {
            sbStr.append(" and loginname = ? ");
            paramList.add(loginname);
        }
        if (ObjectUtil.isNotEmpty(tengxuncode)) {
            sbStr.append(" and tengxuncode = ? ");
            paramList.add(tengxuncode);
        }
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);

    }

    public List<AppUser> findOnlineUser(Integer online) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder(
                "select * from app_user where 1 = 1");
        if (ObjectUtil.isNotEmpty(online)) {
            sbStr.append(" and onlinestatus = ? ");
            paramList.add(online);

        }
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class);
    }

    public void updateMobileSpec(Integer id, String mobileSpec) {
        String sql = " UPDATE app_user SET mobileSpec = ? where id = ? ";
        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(mobileSpec);
        paramList.add(id);
        this.update(sql, paramList);
    }


    public void updateOnline(Integer id, Integer onlinestatus) {
        String sql = " UPDATE app_user SET onlinestatus = ? where id = ? ";
        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(onlinestatus);
        paramList.add(id);
        this.update(sql, paramList);
    }

    public void upstateWindowTicket(Integer id) {

        String sql = " UPDATE app_user SET windowTicket = 1 where id = ? ";
        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(id);
        this.update(sql, paramList);
    }

    public List<AppUser> isBlackList() {

        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_user where 1 = 1 and states = 2");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class);
    }

    public List<AppUser> getUserInfoSearch(String loginNames) {

        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder(" select * from app_user where 1 = 1 ");

        if (ObjectUtil.isNotEmpty(loginNames)) {
            sbStr.append(" and loginname in (" + loginNames + ")");
        }
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppUser.class);
    }

    public AppUser getUserAccount(String account) {

        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder(" select * from app_user where 1 = 1 ");

        if (ObjectUtil.isNotEmpty(account)) {
            sbStr.append(" and loginname = (" + account + ")");
        }

        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppUser.class);
    }

    public List<AppUser> findUpDataList(Integer sex, Integer isReal) {
        ArrayList<Object> list = new ArrayList<>();
        StringBuilder str = new StringBuilder("select * from app_user where ");
        str.append("sex = ?").append(" and isReal = ?");
        list.add(sex);
        list.add(isReal);
        String sql = str.toString();
        return this.queryList(sql, list, AppUser.class);
    }

    public void upweChatNum(Integer id, String weChatNum) {
        String sql = " UPDATE app_user SET weChatNum = ? where id = ? ";
        ArrayList<Object> paramList = new ArrayList<>();
        paramList.add(weChatNum);
        paramList.add(id);
        this.update(sql, paramList);
    }

    public List<AppUser> findUserListByTxcodes(String txcodes) {
        StringBuilder str = new StringBuilder("select * from app_user where ");
        str.append("tengxuncode in(").append(txcodes).append(")");
        String sql = str.toString();
        return this.queryList(sql, null, AppUser.class);
    }
}


